package com.chenfan.mcn.enums;

import com.chenfan.common.extension.dict.DictTranslator;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 删除枚举
 *
 * @author wulg
 * @date 2021-09-13
 **/
@SuppressWarnings("AlibabaEnumConstantsMustHaveComment")
@AllArgsConstructor
public enum DeleteEnum implements DictTranslator<Integer, String> {

    FALSE(0,"否"),

    TRUE(1,"是");


    @Getter
    private final Integer value;

    @Getter
    private final String desc;

    @Override
    public String translate(Integer code) {
        if(Objects.nonNull(code))  {
            for (DeleteEnum item : DeleteEnum.values()) {
                if (item.value.intValue() == code.intValue()) {
                    return item.desc;
                }
            }
        }
        return null;
    }

    public static boolean isDeleted(Integer value) {
        return DeleteEnum.TRUE.value.equals(value);
    }
}
